import { SerializeStream } from "../../Framework/Serialize/SerializeStream";
import { SPlayerScore } from "./SPlayerScore";
//class SeqPlayerScoreHelper
// did
export class SeqPlayerScoreHelper {
  public static write(arg1: SerializeStream, arg2: Array<SPlayerScore>): void {
    if (arg2 != null) {
      arg1.writeSize(arg2.length);
      let i = 0;
      while (i < arg2.length) {
        arg2[i].__write(arg1);
        ++i;
      }
    } else {
      arg1.writeSize(0);
    }
    return;
  }

  public static read(arg1: SerializeStream) {
    var ret: SPlayerScore[] = [];
    var loc2 = arg1.readSize();
    arg1.startSeq(loc2, 31);
    var i = 0;
    while (i < loc2) {
      let entity = new SPlayerScore();
      entity.__read(arg1);
      ret[i] = entity;
      arg1.checkSeq();
      arg1.endElement();
      ++i;
    }
    arg1.endSeq(loc2);
    return ret;
  }
}
